<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>项目列表</title>
    <script src="/static/bflow/assets/js/scriptLib.js"></script>
    <script src="/static/bflow/assets/js/tableScriptLib.js"></script>
    <script src="/static/bflow/assets/js/bootsTableUtil.js"></script>
</head>
<body>
<div class="container">
    <div class="page-header">
        <h1>项目列表
            <small><a href="/index.html" class="btn btn-link">首页</a></small>
        </h1>
    </div>
    <ul class="nav nav-tabs">
        <li class="active"><a href="/static/bflow/ui/example/neg/list.html"><span>全部</span></a></li>
        <li class=""><a href="/static/bflow/ui/example/neg/assignList.html"><span>分派</span></a></li>
        <li class=""><a href="/static/bflow/ui/example/neg/auditList.html?isValid=true"><span>验证中</span></a></li>
        <li class=""><a href="/static/bflow/ui/example/neg/auditList.html"><span>待审批</span></a></li>
    </ul>
    <table id="dataList" data-mobile-responsive="true">
        <thead>
        <tr>
            <th data-formatter="indexFormatter">序号</th>
            <th data-field="id" data-visible="false">流程实例ID</th>
            <th data-field="extVarchar1" data-formatter="proNameFormatter">项目名</th>
            <th data-field="extBigint2">项目ID</th>
            <th data-field="extVarchar2">城市</th>
            <th data-field="startUname">提交人</th>
            <th data-field="extBigint1">议标ID</th>
            <th data-field="extVarchar3" data-visible="false">资源UUID</th>
            <th data-field="extVarchar4" data-visible="false">资源网址</th>
            <th data-field="extVarchar5" data-visible="false">企业法人身份证</th>
            <th data-field="extDatetime1">项目发布日期</th>
            <th data-field="extDatetime2">报名截止时间</th>
            <th data-field="extNumeric1">标的</th>
            <th data-field="createTime" data-sortable="true" data-order="desc">提交时间</th>
            <th data-field="status" data-formatter="statusFormatter">流程状态</th>
            <th data-formatter="operationFormatter">画板操作</th>
        </tr>
        </thead>
        <tbody></tbody>
    </table>
</div>
</body>
<script type="text/javascript">
    //加载数据
    BootstrapTableUtil.initTableDataByServer("/example/neg/list");

    function proNameFormatter(value, row, index) {
        var link = '<a href="/static/bflow/ui/example/neg/view.html?instanceId='+row.id+'">'+value+'</a>';
        return link;
    }

    function statusFormatter(value, row, index) {
        var css = "default", text = value;
        if("finish"==row.status){
            css = "success text-status-succ", text = "结束";
        }else if("cancel"==row.status){
            css = "muted", text = "取消";
        }else if("run"==row.status){
            css = "warning text-status-warn", text = "运行中";
        }
        var str = '<label class="text-'+css+'">'+text+'</label>';
        return str;
    }

    function operationFormatter(value, row, index){
            var str='<a href="#" onclick="drawBoardView(\''+row.id+'\')" class="btn btn-primary btn-xs" style="margin-left: 5px">查看画板</a>';
            return  str;
    }

    function drawBoardView(id){
        window.location.href="/static/bflow/ui/drawBoard/draw.html?id="+id+"&isView=1";
    }

</script>
</html>